<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" th:with="title='登陆',active='index'"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!-- head 头部-->
<head th:replace="web/common/fragment::head(${title},null,'/assets/css/login.css')"></head>
<style>
	body{
		line-height: 24px;
		margin-top: 0px !important;
	}
</style>
<body>
<div class="login-body">
		<form class="layui-card-body layui-form layui-form-pane">
			<input type="hidden" name="ref" th:value="${ref}">
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
				<div class="layui-input-block">
					<input name="username" type="text" lay-verify="required" placeholder="账号"
						   class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
				<div class="layui-input-block">
					<input name="password" type="password" lay-verify="required" placeholder="密码"
						   class="layui-input">
				</div>
			</div>
			<!-- <div class="layui-form-item">
                <label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
                <div class="layui-input-block">
                    <div class="layui-row inline-block">
                        <div class="layui-col-xs7">
                            <input name="code" type="text" lay-verify="required" placeholder="验证码"
                                   class="layui-input">
                        </div>
                        <div class="layui-col-xs5" style="padding-left: 10px;">
                            <img class="login-captcha" src="${ctxPath }/assets/captcha">
                        </div>
                    </div>
                </div>
            </div> -->
			<div class="layui-form-item">
				<a href="javascript:;" onclick="showRegForm()" class="layui-link">帐号注册</a>
				<a href="javascript:;" onclick="showFindPwdForm()" class="layui-link pull-right">忘记密码？</a>
			</div>
			<div class="layui-form-item">
				<button lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
			</div>
			<div class="layui-form-item login-other">
				<label>第三方登录</label>
				<a href="javascript:;" onclick="top.layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:1500},function() {
				  top.window.location.href='/oauth/render/qq';
				})" title="QQ登入"><i class="layui-icon layui-icon-login-qq"></i></a>
				<a href="javascript:;" onclick="top.layer.msg('正在通过微信登入', {icon:16, shade: 0.1, time:1500},function() {
				  top.layer.msg('暂时不支持微信登陆', {icon: 5});
				})" title="QQ登入"><i class="layui-icon layui-icon-login-wechat"></i></a>
				<a href="javascript:;" onclick="top.layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:1500},function() {
				  top.layer.msg('暂时不支持微博登陆', {icon: 5});
				})" title="QQ登入"><i class="layui-icon layui-icon-login-weibo"></i></a>
			</div>
		</form>
</div>

<!--	引入JS	-->
<div th:replace="web/common/fragment::js"></div>
<script>
    layui.use(['form','admin'], function(){
        var form = layui.form;
        var $ = layui.jquery;
		var admin  = layui.admin;
		// 表单提交
		form.on('submit(login-submit)', function (obj) {
			layer.load(2);
			$.post('/login', obj.field, function (data) {
				if (data.success) {
					layer.msg('登录成功', {icon: 1, time: 1500,skin:'layui-layer-admin'}, function () {
						//top.window.location.href="/";
						top.window.location.reload();
					});
				} else {
					layer.closeAll('loading');
					layer.msg(data.msg, {icon: 5,skin:'layui-layer-admin'});
					/*  $('.login-captcha').trigger('click'); */
				}
			}, 'JSON');
			return false;
		});
    })

</script>




</body>
</html>
